<?php

{$AUTO_GENERATOR_INCLUDE_HEADER_TEMPLATE}

defined('_JEXEC') or die;

class {$AUTO_GENERATOR_COMPONENT|capitalize}Controller{$AUTO_GENERATOR_CONTROLLERS|capitalize} extends JControllerAdmin {

    public function __construct($arConfig = array()) {
        parent::__construct($arConfig);
    }

    public function getModel($strName = '{$AUTO_GENERATOR_MODEL|capitalize}', $strPrefix = '{$AUTO_GENERATOR_COMPONENT|capitalize}Model', $arConfig = array('ignore_request' => true)) {
        return parent::getModel($strName, $strPrefix, $arConfig);
    }
    
    public function saveOrderAjax() {
        $pks = $this->input->post->get('cid', array(), 'array');
        $order = $this->input->post->get('order', array(), 'array');

        // Sanitize the input
        JArrayHelper::toInteger($pks);
        JArrayHelper::toInteger($order);

        // Save the ordering
        $return = $this->getModel()->saveorder($pks, $order);

        if ($return) {
            echo "1";
        }
        
        // Close the application
        JFactory::getApplication()->close();
    }
}
